<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Exibir Ideia</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/reset.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css"/>
        <script type="text/javascript" src="<?php echo base_url() ?>js/jquery-1.6.js"></script>
        <script type="text/javascript" src="<?php echo base_url() ?>js/jquery.validate.js" ></script>

        <script type="text/javascript" src="<?php echo base_url(); ?>js/core.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>js/validate_form.js"></script>
        <style type="text/css">
            div.reply .aprovar span {
                display: block;
                width: 81px;
                height: 33px;
                background: url(<?php echo base_url(); ?>img/btn_aprovar.png) 0 0 no-repeat;
            }

            div.reply .aprovar:hover span {
                background: url(<?php echo base_url(); ?>img/btn_aprovar.png) 0 -34px no-repeat;
            }

            div.reply_aprovado {
                background: url(<?php echo base_url(); ?>img/bg_aprovado.png) bottom right no-repeat #EAFFEA;
                border: 1px solid #DAEFDA;
                border-left: 8px solid #DAEFDA;
            }

        </style>
    </head>
    <body>
        <?php
        include ("includes/nav_bar.php");
        ?>
        <div id="main-content">
            <div id="conteudo">
                <h1 style="margin: 10px 0;"><?php echo $view_titulo; ?></h1>
                <div class="ideia-inicial">
                    <p class="ideia">&ldquo;<?php echo $view_descricao; ?>&rdquo;</p>
                    <p class="autor"><?php echo "por ".$view_autor." em ".formatDate($view_data, false)."."; ?></p>
                </div>
                <h1 style="margin: 20px 0 15px;">Respostas</h1>
                <?php
                if(isset($view_replys)):
                    foreach($view_replys as $view_reply):
                        $aux = ($view_reply->int_aprovado) ? "reply_aprovado" : "";
                        ?>
                        <div class="reply <?php echo $aux; ?>">
                            <p class="texto"><?php echo $view_reply->char_descricaoReply; ?></p>
                            <p class="autor"><?php echo "por ".$view_reply->char_nomeUsuario." em ".formatDate($view_reply->date_dataCriado, true)."."; ?></p>
                            <?php if(!$view_reply->int_aprovado && $view_proprietario): ?>
                                <span class="aprovar">
                                    <a href="<?php echo base_url(); ?>ideias/aprovar/ideia/<?php echo $view_idIdeia ?>/reply/<?php echo $view_reply->pk_int_idReply; ?>">
                                        <span></span>
                                    </a>
                                </span>
                            <?php endif; ?>
                        </div>
                        <?php
                    endforeach;
                else:
                    echo "<div class='reply'><p class='texto'>Nenhum reply até o momento, por que não ser o primeiro?</p></div>";
                endif;
                ?>
                <h1 style="margin: 20px 0 10px;">Contribua com o autor...</h1>
                <form class="form-reply" action="<?php echo base_url(); ?>ideias/salvarReply" method="POST" >
                    <p><label class="medio" style="vertical-align: top;">Reply:</label><textarea name="reply" cols="54" rows="10" id="reply"></textarea></p>
                    <input type="hidden" name="id_ideia" value="<?php echo $view_idIdeia ?>"></input>
                    <p><input type="submit" name="enviar" value="Enviar" class="btn"/></p>
                </form>
            </div>
        </div>
    </body>
</html>